
/**
 * 财务管理控制层
 */
define([ "app", "jquery", "md5", "ecb", 
        "services/UserService",
        "services/TipsService",
		"resources/UserResource","resources/AddYokiCountryResource"], function(app) {

	var deps = [ "$scope", "$state", "$modal","$location", "$stateParams","UserService","TipsService","UserResource","AddYokiCountryResource" ];

	function controller($scope, $state, $modal,$location, $stateParams,UserService,TipsService,UserResource,AddYokiCountryResource) {
		
		$scope.uploadFile =function(){
			var file =$('#textfield').val();
			var formData = new FormData(document.forms.namedItem("fileinfo")); 
			if(file ==null || file==""){
				alert("请选中上传文件!");
				return;
			}else{
				AddYokiCountryResource.uploadFile($scope.upload.type,formData).success(function(data){
					if (data) {
						$('#textfield').val("");
						$('#fileField').val("");
						$scope.upload.type="";
						TipsService.show(data.fileId);
					}
	            });
			}
		};
	}
	controller.$inject = deps;
	return app.lazy.controller("UploadManagementController", controller);
});
